/*
 * Copyright (c) 2002 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.internal.model;

import java.util.Date;

import net.sourceforge.perforce.core.api.IPerforceServer;
import net.sourceforge.perforce.core.resources.IChangelist;
import net.sourceforge.perforce.ui.internal.Policy;

/**
  * @version $Revision: 45 $
  * @author  <a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class DefaultChangelistElement extends ChangelistElement
{	
	// ------------------------------------------------------------------------- Public Constructors
	
	/** Constructor for ChangelistElement. 
	  * 
	  * @param server reference to the Perforce server.
	  */
	public DefaultChangelistElement(IPerforceServer server)
	{
		super(server, IChangelist.DEFAULT);
		
		setClientName(server.getClient());
		setUserName(server.getUser());
		setDescription("");
	}
	
	// ---------------------------------------------------------------- Public Methods (IChangelist)
	
	/** @see net.sourceforge.perforce.ui.internal.model.ChangelistElement#getDate() */
	public Date getDate() 
	{
		return new Date();
	}
	
	// ---------------------------------------------------------- Public Methods (IWorkbenchAdapter)
	
	/** @see net.sourceforge.perforce.ui.internal.model.ChangelistElement#getLabel(Object) */
	public String getLabel(Object o) 
	{
		if (!(o instanceof DefaultChangelistElement))
		{
			return null;
		}
		
		return Policy.bind("DefaultChangelistElement.getLabel");
	}		
}
